﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfForumInfo.aspx.cs" Inherits="msBsc.WebUi.wMall.Public.wfForumInfo" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>推荐详情</title>
    <link href="/jqPlugin/SelectSimu/css/base.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/pagination.css" rel="stylesheet" />
    <style type="text/css">
        /*start 论坛详情*/
        .formList {
            min-height: 671px;
            text-align:left;
        }

        .releasePeople {
            width: 247px;
            height: auto;
            float: left;
        }

        .releaseInfo {
            width: 953px;
            height: auto;
            float: left;
        }

        .clear {
            clear: both;
        }

        .releasePimg {
            width: 106px;
            height: 106px;
            cursor: pointer;
            margin: auto;
        }

            .releasePimg img {
                width: 106px;
                height: 106px;
                border-radius: 50% !important;
                -moz-border-radius: 50% !important;
                -webkit-border-radius: 50% !important;
            }

        .releaseName {
            width: 247px;
            text-align: center;
            color: #706f6f;
            font-size: 14px;
            font-family: 微软雅黑;
            line-height: 30px;
        }

        .releaseInfo .forumTitle {
            height: 30px;
            line-height: 30px;
            font-size: 16px;
        }

        .releaseContent {
            width: 953px;
            overflow: hidden;
        }

            .releaseContent img {
                max-width: 953px;
            }

        .releaseTime {
            width: 100%;
            text-align: right;
            font-size: 14px;
            font-family: 微软雅黑;
            color: #706f6f;
            height: 30px;
            line-height: 30px;
        }

            .releaseTime span {
                display: inline;
                float: right;
                padding-right: 20px;
            }

        .replyClick {
            cursor: pointer;
        }

        .reply {
            display: none;
        }

            .reply .replyTxt {
                width: 99%;
                height: 100px;
                padding: 0px;
                margin: 0px;
                border: 1px solid #c7c5c5;
            }

                .reply .replyTxt:hover {
                    border: 1px solid #3992dd;
                }

        .r_button {
            margin: 10px 0px;
            padding-left: 20px;
        }

            .r_button input {
                cursor: pointer;
            }
        /*start 评论*/
        .reviewPeople {
            width: 70px !important;
        }

        .reviewPimg {
            width: 46px !important;
            height: 46px !important;
        }

            .reviewPimg img {
                width: 46px !important;
                height: 46px !important;
                border-radius: 50% !important;
                -moz-border-radius: 50% !important;
                -webkit-border-radius: 50% !important;
            }

        .reviewName {
            width: auto !important;
            text-align: left;
        }

        .reviewInfo {
            width: 883px !important;
        }

            .reviewInfo .releaseContent {
                width: 883px !important;
            }

                .reviewInfo .releaseContent img {
                    max-height: 720px !important;
                }

        .hthreeInfo {
            width: 813px !important;
        }

            .hthreeInfo .releaseContent {
                width: 813px !important;
            }

                .hthreeInfo .releaseContent img {
                    max-height: 813px !important;
                }

        ol li {
            margin: 5px 0px !important;
        }

        .replyListInfo {
            margin-left: 247px;
        }

        .replyName {
            padding: 0px 3px;
            color: #3992dd;
            cursor: pointer;
        }

        .viewPC {
            margin-top:20px;
        }
       
    </style>
</head>
<body>
    <%=msBsc.WebUi.Code.QtHtmlGet.GetHeaderLoginInfo() %>
    <div class="viewPC">
        <input type="hidden" id="forumId" />
        <div class="formList">
            <div>
                <div class="releasePeople">
                    <div class="pInfo">
                        <div class="releasePimg">
                            <a target="_blank" href="#" id="pfhrefImg">
                                <img id="pfImg" /></a>
                        </div>
                        <div class="releaseName"><a id="pfName" target="_blank" href="#" style="color: #3992dd;"></a></div>
                    </div>
                </div>
                <div class="releaseInfo">
                    <div class="forumTitle" id="pfTitle">
                    </div>
                    <div class="releaseContent" id="pfContent">
                    </div>
                   <%-- <div class="releaseTime">
                        <span data-value="" id="pfReplyId" class="replyClick">回复</span>
                        <span id="pfTime"></span>
                    </div>
                    <div class="reply">
                        <div>
                            <textarea name="content" class="replyTxt"></textarea>
                        </div>
                        <div class="r_button">
                            <input type="button" onclick="reply(this)" value="回复评论" />
                            <input type="button" onclick="cancelReply()" value="取消" />
                        </div>
                    </div>--%>

                </div>
                <div class="clear"></div>
            </div>
            <%--<div class="replyListInfo">
                <ol id="replyInfo">
                </ol>
            </div>--%>
        </div>
        <%--<div class="jpage" id="divPage"></div>--%>
    </div>
    <%=msBsc.WebUi.Code.QtHtmlGet.GetFloorHtml() %>
</body>
<!--start JS引用-->
<script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
<script src="/jqPlugin/js/jBase.js"></script>
<script src="/jqPlugin/js/jBPage.js"></script>
<script src="/jqPlugin/js/laytpl.js"></script>
<script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
<script src="/themes/wStyle1/js/comm/jsLayout.js"></script>
<script src="/themes/wStyle1/js/comm/jsPagination.js"></script>
<script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
<!--end JS引用-->
<script type="text/javascript">
    var replyId = "";
    (function () {
        $("#forumId").val(GetQueryStr("forumId"));
        //回复按钮
        $(".replyClick").live("click", function () {
            $(".reply").hide();
            $(".replyTxt").val("");
            $(this).parent(".releaseTime").next(".reply").show();
            replyId = $(this).attr("data-value");
        });
    })()

    var pIndex = 1;
    var pageSize = 5;
    function btnDo(sEbtn) {
        GtGrid1Action = sEbtn;
        var opart = new jsonRow();
        if (GtGrid1Action=="init") {
            opart = addNoAreStatistics(opart, "旅游推荐详情", "w0015");
        }
        opart.AddCell("forumId", $("#forumId").val());
        opart.AddCell("pIndex", pIndex);
        opart.AddCell("pRows", pageSize);
        opart.AddCell("ACTION", GtGrid1Action);
        ajaxComm(opart);
        $().eq(1).addClass()
    };

    //执行AJAX调用时获取参数
    function GetGtParam() {
        var _jsParam = new jsonRow();
        _jsParam.AddCell("pIndex", pIndex);
        _jsParam.AddCell("pRows", pageSize);
        _jsParam.AddCell("ACTION", GtGrid1Action);
        return _jsParam;
    };

    function goPage(Index) {
        pIndex = Index;
        btnDo("getReply");
    }

    btnDo("init");

    function doBoundContent(_shopurl) {
        if (_shopurl != null && _shopurl != undefined && _shopurl != '') {
            jQuery.loadHtml(_shopurl).done(function (_rethtml) {
                var tpl = HtmlUtil.htmlDecode(_rethtml);
                $("#pfContent").html(tpl);
            });
        }
    };

    function setForumInfo(data) {
        $("#pfImg").attr("src", data.rows[0].CUSTOMER_DEFAULT_PIC + " 106x106img.jpg");
        $("#pfName").text(data.rows[0].CUSTOMER_NICK);
        $("#pfName").attr("href", "/wp_DjackVehicle.htm?djackId=" + data.rows[0].POSTS_PUBLISH_BY);
        $("#pfhrefImg").attr("href", "/wp_DjackVehicle.htm?djackId=" + data.rows[0].POSTS_PUBLISH_BY);
        $("#pfTitle").text(data.rows[0].SOURCE_POSTS_TITLE);
        //$("#pfContent").html(data.rows[0].POSTS_CONTENT);
        doBoundContent(data.rows[0].CONTENT_HTML_URL)
        $("#pfTime").text(data.rows[0].POSTS_PUBLISH_TIME);
        $("#pfReplyId").attr("data-value", data.rows[0].SOURCE_POSTS_ID);
    }

    /*
        * 回复帖子
        * 
    */
    function reply(button) {
        var replyInfo = $(button).parents(".reply").find(".replyTxt").val();
        if (IsNull(replyInfo)) {
            alert("请输入回复内容");
            return;
        }
        if (IsNull(replyId)) {
            alert("请选择回复对象");
            return;
        }
        var opart = new jsonRow();
        opart.AddCell("replyInfo", replyInfo);
        opart.AddCell("replyId", replyId);
        opart.AddCell("pIndex", pIndex);
        opart.AddCell("pRows", pageSize);
        opart.AddCell("forumId", $("#forumId").val());
        opart.AddCell("ACTION", "reply");
        ajaxComm(opart);
    }
    var rHtml = "";//回复html
    var fistTemp = "<li><div class='releasePeople reviewPeople'><div class='pInfo'><div class='releasePimg reviewPimg'><a target='_blank' ><img title='$replyByName$' src='$replyByImg$' /></a></div></div></div><div class='releaseInfo reviewInfo'><div class='releaseContent'><a target='_blank'  class='replyName'>$replyPeople$</a>：$replyContent$</div><div class='releaseTime'><span data-value='$thisId$' class='replyClick'>回复</span><span>$replyTime$</span></div><div class='reply'><div><textarea name='content' class='replyTxt'></textarea></div><div class='r_button'><input type='button' onclick='reply(this)' value='回复评论' /><input type='button' onclick='cancelReply()' value='取消' /></div></div><ol>";

    var noFistTemp = "<li><div class='releasePeople reviewPeople'><div class='pInfo'><div class='releasePimg reviewPimg'><a target='_blank' ><img title='$replyByName$' src='$replyByImg$' /></a></div></div></div> <div class='releaseInfo hthreeInfo'><div class='releaseContent'><a target='_blank'  class='replyName'>$replyPeople$</a>回复<a target='_blank' class='replyName'>$publisherPeople$</a>：$replyContent$</div><div class='releaseTime'><span data-value='$thisId$' class='replyClick'>回复</span><span>$replyTime$</span></div><div class='reply'><div><textarea name='content' class='replyTxt'></textarea></div><div class='r_button'><input type='button' onclick='reply(this)' value='回复评论' /><input type='button' onclick='cancelReply()' value='取消' /></div></div></div><div class='clear'></div></li>"

    function setReplyList(data, parentId) {
        $("#replyInfo").html("");
        rHtml = "";
        $("#replyInfo").html(showReplyListHtml(data.rows, parentId, true));
    }

    //
    function showReplyListHtml(dataList, parentId, isFirst) {
        if (IsNull(dataList)) {
            return "";
        }
        var count = 0;
        for (var i = 0; i < dataList.length; i++) {
            count++;
            if (dataList[i].RECOVER_TO_POSTS == parentId) {
                var html = "";
                if (isFirst) {
                    if (!IsNull(rHtml)) {
                        rHtml += "</ol></div><div class='clear'></div></li>";
                    }
                    html = fistTemp;
                } else {
                    html = noFistTemp;
                }
                var recoverNickName = IsNull(dataList[i].RecoverNickName) ? "" : dataList[i].RecoverNickName;
                var recoverToNickName = IsNull(dataList[i].RecoverToNickName) ? "" : dataList[i].RecoverToNickName;
                html = html.replace("$replyByImg$", dataList[i].CUSTOMER_DEFAULT_PIC + " 46x46img.jpg");
                html = html.replace("$replyByUrl$", "/wp_DjackVehicle.htm?djackId=" + dataList[i].RECOVER_BY_ID);
                html = html.replace("$replyPeopleUrl$", "/wp_DjackVehicle.htm?djackId=" + dataList[i].RECOVER_BY_ID);
                html = html.replace("$publisherPeopleUrl$", "/wp_DjackVehicle.htm?djackId=" + dataList[i].BE_RECOVER_ID);
                html = html.replace("$replyByName$", dataList[i].RECOVER_BY_PERSON);
                html = html.replace("$replyPeople$", dataList[i].RECOVER_BY_PERSON);
                html = html.replace("$publisherPeople$", dataList[i].BE_RECOVER_NICK);
                html = html.replace("$replyContent$", dataList[i].REVOCER_CONTENT);
                html = html.replace("$thisId$", dataList[i].RECOVER_POSTS_ID);
                html = html.replace("$replyTime$", dataList[i].REVOCER_TIME);
                rHtml += html;
                showReplyListHtml(dataList, dataList[i].RECOVER_POSTS_ID, false);
            }
        }
        if (isFirst && !IsNull(rHtml)) {
            rHtml += "</ol></div><div class='clear'></div></li>";
        }
        if (count == dataList.length) {

            return rHtml;
        }
    }

    /*
 * 取消回复
*/
    function cancelReply() {
        $(".reply").hide();
        $(".replyTxt").val("");
        replyId = "";
    }
</script>
</html>
